<script language="JavaScript" type="text/javascript">
<!--

function rate_subject()
{
  document.rs.submit() ;
}

function add_res()
{
  document.adds.submit();
}

-->
</script>
<p>

<div style="border: 3px solid white;background:#901315;padding-left:50px;padding-right:50px; padding-bottom: 15px; padding-top:15px;margin-bottom:15px;">
</p><?= $error; ?>
<p><div style="float:right;"><?php echo anchor('user_control/view_instructors/'.$subject, 'View Instructor List', array('style'=>'color:#FFEA00; font-size:12px; text-decoration:none;')) ; ?></div></p><br>
<?php
	if($admin) {
		echo '<p><div style="float:right">';
		echo anchor('user_control/add_instructor/'.$subject, 'Add Instructor', array('style'=>'color:#FFEA00; font-size:12px; text-decoration:none;'));
		echo '</div></p>';
	}
?>
	<?php
			$rating = 0;
			foreach($profile->result() as $r) {
				$rating = $r->Rating;
				echo '<p><span style="font-size:22px; color:#FFEA00;">';
				echo $subject;
				echo '</span><span style="font-size:20px;"> - '.$r->SubjectTitle.'</span></p>';
				echo '<p style="font-size:14px;">';
				echo '<div class="lab">Type</div><div class="val"> &nbsp&nbsp   '.$r->Type.'</div><br>'.'<div class="lab">Average Rating</div><div class="val"> &nbsp&nbsp  ';
				//echo (int)$r->Rating;
				echo '</div>';
				
			}
			$i = 0;
			while($i < $rating) {
				echo '<img src="'.$base.'/'.$images.'/blue.gif">';
				$i = $i+1;
			}
			while($i < 10) {
				echo '<img src="'.$base.'/'.$images.'/red.gif">';
				$i = $i+1;
			}	
			echo '</p>';
	?>
	<div id="rate_sub_link">
<?php
	echo form_open('user_control/rate', array('id'=>'rs', 'name'=>'rs'), array('subject'=>$subject));
?>
	<a href="javascript:rate_subject()">Rate 
<?php
echo $subject;
?>
</a>
<select name="rating">
		  <option value ="1">1</option>
		  <option value ="2">2</option>
		  <option value ="3">3</option>
		  <option value ="4">4</option>
		  <option value ="5">5</option>
		  <option value ="6">6</option>
		  <option value ="7">7</option>
		  <option value ="8">8</option>
		  <option value ="9">9</option>
		  <option value ="10">10</option>
</select>
</p>
</form>
</div>

</div>
<div id="body">
<?= $error_for_delete; ?>
	<p><h1 style="color:white">Subject Resources</h1></p>
	<br>
	<div id="subj_res">
<?php
			foreach($resources->result() as $row) {
				//echo '<p>';

				if($admin) {
					echo anchor('user_control/delete_submission_from_subject/'.$subject.'/'.$row->ResourceIDNo, img('images/delete_record.gif'), array('title'=>'Delete Resource'));
					echo '&nbsp&nbsp&nbsp';
				}
				
				echo anchor('user_control/subjects_profile/'.$subject.'/'.$row->ResourceIDNo, $row->Title);
				echo ' - '.ucwords($row->Type);
				echo '</p>';
			}
?>
	<br><br><br>
</form>
<div id="add_res_link">
<?php
	echo form_open('user_control/add_resource/'.$subject, array('id'=>'adds', 'name'=>'adds'), array('subject'=>$subject));
?>
	<a href="javascript:add_res()">Add  
<?php
echo $subject;
?> Resource
</a>
<select name="res_type">
		  <option value ="link">Link</option>
		  <option value ="reference">Reference</option>
		  <option value ="file">File</option>
</select>
</p>
</form>
</div>

</div>
